package com.aaa.vegetablemarketexpress.util;

/**
 * @FileName: ResultUtil
 * @Description:    统一返回结果工具类封装
 * @Author: 张钰哲
 * @CreateTime: 2025/8/22 11:01
 * @Version: 1.0.0
 */

public class ResultUtil {
    /**
     * 统一返回成功
     * @param data
     * @return
     * @param <T>
     */
    public static <T> Result  success(T data){
        return new Result(ResultStatus.SUCCESS.getStatusCode(), ResultStatus.SUCCESS.getStatusMsg(), data);
    }

    /**
     * 统一返回失败
     * @param data
     * @return
     * @param <T>
     */
    public static <T> Result  failed(T data){
        return new Result(ResultStatus.FAILED.getStatusCode(),ResultStatus.FAILED.getStatusMsg(),data);
    }
}
